<?php if (!(isset($this->request->params['prefix']) and $this->request->params['prefix'] == 'admin')) {?>
<?php } else { ?>
    <?php if(empty($this->request->params['admin'])) {?>
		<h2 class="project-title"><?php echo sprintf(__l('Edit Profile - %s'), $this->request->data['User']['username']); ?></h2>
	 <?php } ?>
<?php } ?>
<?php if (!(isset($this->request->params['prefix']) and $this->request->params['prefix'] == 'admin')) { ?>
	<div class="container_24 clearfix space-top">
<div class="shodow-tl">
   <div class="shodow-tr">
    <div class="shodow-tm"> </div>
  </div>
</div>
<div class="shodow clearfix">
    	<h2 class="project-title"><?php echo sprintf(__l('Edit Profile - %s'), $this->request->data['User']['username']); ?></h2>
     	<?php echo $this->element('user-avatar', array('config' => 'sec')); ?>
</div>

			<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
								<div class="shad-bg">
<div class="userProfiles form main-section">
<?php } ?>
	<div class="js-corner round-5 user-profile-form round-5">
		<div class="form-blocks js-corner round-5">
			<?php echo $this->Form->create('UserProfile', array('action' => 'edit', 'class' => 'normal clearfix ', 'enctype' => 'multipart/form-data'));?>

				<fieldset class="fields-block round-5">
                 <legend><?php echo $this->Html->link(__l('Users'), array('controller'=>'users','action'=>'view',$this->request->data['User']['username'],'admin'=>false),array('title' => __l('Users')));?> &raquo; <?php echo __l('Edit Profile');?></legend>
					<h3 class="disk-usage"><?php echo __l('Personal Info');?></h3>
					<div class="clearfix user-profile-block">
						<div class="profile-image">
						<?php
							if(!empty($this->request->data['User']['fb_user_id']))
							{
							?>
							<?php echo $this->Html->getUserAvatar($this->request->data['User']['id'],'big_thumb'); ?>
							<?php
							}
							else
							{
							?>
							<?php /*echo $this->Html->link($this->Html->showImage('UserAvatar', $this->request->data['UserAvatar'], array('dimension' => 'big_thumb', 'alt' => sprintf(__l('[Image: %s]'), $this->Html->cText($this->request->data['User']['username'], false)), 'title' => $this->Html->cText($this->request->data['User']['username'], false))), array('controller' => 'users', 'action' => 'view',  $this->request->data['User']['username'], 'admin' => false), array('escape' => false));*/ ?>
							<?php echo $this->Html->getUserAvatar($this->request->data['User']['id'],'big_thumb'); ?>
							<?php
							}
							?>
						</div>
						<div class="user-edit-profile">
					<?php
						if($this->Auth->user('user_type_id') == ConstUserTypes::Admin):
		                    echo $this->Form->input('User.id');
						endif;
						if($this->request->data['User']['user_type_id'] == ConstUserTypes::Admin):
							echo $this->Form->input('User.username',array('label'=>__l('Username')));
						endif;
						if($this->Auth->user('user_type_id') == ConstUserTypes::Admin):
							echo $this->Form->input('User.email',array('label'=>__l('Email')));
						endif;
						echo $this->Form->input('first_name', array('label'=>__l('First Name')));
						echo $this->Form->input('last_name' , array('label'=>__l('Last Name')));
						echo $this->Form->input('middle_name', array('label'=>__l('Middle Name')));
						echo $this->Form->input('gender_id', array('empty' => __l('Please Select'), 'label'=>__l('Gender')));
					?>
					<div class="input date required">
						<div class="js-datetime">
							<?php echo $this->Form->input('dob', array('label' => __l('DOB'),'empty' => __l('Please Select'), 'div' => false, 'minYear' => date('Y') - 100, 'maxYear' => date('Y'), 'orderYear' => 'asc')); ?>
						</div>
					</div>
					<?php echo $this->Form->input('about_me', array('label'=>__l('About me'))); ?>
				</div>
				</div>
				</fieldset>

				<div class="profile-top profile-block">
				<fieldset class="fields-block">
					<h3 class="disk-usage"><?php echo __l('Address');?></h3>
					<div class="clearfix profile-block">
					<div class="mapblock-info">
                                <div class="clearfix address-input-block">
                                <?php
									echo $this->Form->input('address', array('label' => __l('Address'), 'id' => 'UserAddressSearch', 'info' => __l('You must select address from autocomplete')));
                                ?>
                                </div>
								<?php
								$class = '';
								if (empty($this->request->data['UserProfile']['address']) || ( !empty($this->request->data['UserProfile']['address1']) && !empty($this->request->data['City']['name']) &&  !empty($this->request->data['UserProfile']['country_id']))) {
									$class = 'hide';
								}
							?>
								<div id="js-geo-fail-address-fill-block">
								<div class="clearfix">
									<div class="map-address-left-block address-input-block">
                                <?php	echo $this->Form->input('User.latitude', array('id' => 'latitude', 'type' => 'text'));
									echo $this->Form->input('User.longitude', array('id' => 'longitude', 'type' => 'text'));
									echo $this->Form->input('address1', array('id' => 'js-street_id','type' => 'text', 'label' => __l('Address')));
									echo $this->Form->input('country_id',array('id'=>'js-country_id','empty' => 'Please select', 'selected' => ((!empty($this->request->data['UserProfile']['Country']['iso2']))? $this->request->data['UserProfile']['Country']['iso2'] : '')));
									echo $this->Form->input('State.name', array('type' => 'text', 'label' => __l('State')));
									echo $this->Form->input('City.name', array('type' => 'text', 'label' => __l('City')));
								?>

									</div>
							</div>
								</div>
								<div class="js-side-map-div">
										<h3><?php echo __l('Point Your Location');?></h3>
										<div class="js-side-map">
											<div id="js-map-container"></div>
											<span><?php echo __l('Point the exact location in map by dragging marker');?></span>
										</div>
									</div>
								<div id="mapblock">
									<div id="mapframe">
										<div id="mapwindow"></div>
									</div>
								</div>
								</div>
					<?php
						echo $this->Form->input('language_id', array('empty' => __l('Please Select'), 'label'=>__l('Language')));
						echo $this->Form->input('zip_code', array('label'=>__l('Zip Code')));
					?>
					</div>
					</fieldset>
					</div>

				<fieldset class="fields-block">
					<h3 class="disk-usage"><?php echo __l('Websites');?></h3>
					<div class="clearfix">
					<div class="js-clone">
						<span class ="js-add-more clone-add"><?php echo __l('Add More'); ?></span>
						<?php if(empty($this->request->data['UserWebsite'])): ?>
							<div class="website-block js-field-list">
								<?php echo $this->Form->input('UserWebsite.0.website', array('class'=>'home', 'label'=>__l('Website'))); ?>
							</div>
						<?php else:	?>
							<?php foreach( $this->request->data['UserWebsite'] as $key => $userWebsite): ?>
								<div class="phone-block js-field-list">
									<?php if($key):?>
										<span class="js-website-remove clone-remove"><?php echo __l('Remove'); ?></span>
									<?php endif;?>
									<?php echo $this->Form->input('UserWebsite.'.$key.'.website',  array('class'=>'home')); ?>
								</div>
							<?php endforeach;?>
						<?php endif;?>
					</div>
					</div>
					</fieldset>


				<fieldset class="fields-block round-5">
					<h3 class="disk-usage"><?php echo __l('Other');?></h3>
							<div class="clearfix">
					<?php
						if($this->Auth->user('user_type_id') == ConstUserTypes::Admin):
							echo $this->Form->input('User.is_active', array('label' => __l('Active')));
							echo $this->Form->input('User.is_email_confirmed', array('label' => __l('Email confirmed')));
						endif;
						echo $this->Form->input('UserAvatar.filename', array('type' => 'file', 'size' => '33', 'label' => __l('Upload Photo'), 'class' => 'browse-field'));
					?>
					</div>
					</fieldset>

<?php if($this->Auth->user('user_type_id') != ConstUserTypes::Admin): ?>
			<fieldset class="fields-block round-5">
				<h3 class="disk-usage"><?php echo __l('Account'); ?></h3>
						<div class="clearfix">
				<div class="content-info clearfix">
					<?php echo __l('If you don\'t have PayPal account,').' '.$this->Html->link(__l('click here'), array('controller' => 'payments', 'action' => 'create_paypal_account', 'admin' => false)).' '.__l('to create a PayPal account Instantly.'); ?>
				</div>
				<?php
					echo $this->Form->input('paypal_account', array('label' => __l('PayPal Email')));
					echo $this->Form->input('paypal_first_name', array('label' => __l('PayPal First Name'), 'info'=> __l('As given in PayPal')));
					echo $this->Form->input('paypal_last_name', array('label' => __l('PayPal Last Name'), 'info'=> __l('As given in PayPal')));
				?>
				</div>
			</fieldset>
<?php endif; ?>
			<fieldset class="form-actions">
            <div class="submit-block clearfix"><?php echo $this->Form->submit(__l('Update')); ?></div>
			</fieldset>
			<?php echo $this->Form->end(); ?>
		</div>
    </div>
<?php 		     if (!(isset($this->request->params['prefix']) and $this->request->params['prefix'] == 'admin')) {
?>
</div>
	</div>
							</div>
						</div>
						<div class="l-curve-bot">
							<div class="r-curve-bot">
									<div class="bot-bg"></div>
							</div>
						</div>
</div>
<?php } ?>